package com.guigu.controller.lq.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.guigu.controller.lq.mapper.LqVipMapper;
import com.guigu.controller.lq.pojo.LqPhysicaljg;
import com.guigu.controller.lq.pojo.LqVip;
import com.guigu.controller.lq.pojo.PageVO;
import com.guigu.controller.lq.service.LqVipSetvice;
import com.guigu.pojo.Vip;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class LqVipServiceimpl implements LqVipSetvice {
    @Autowired
    LqVipMapper lqVipMapper;
    public Vip byid(String vipid) {
        Vip byid = lqVipMapper.byid(vipid);

        return byid;
    }

    public Vip findzb(Integer vid) {
        return lqVipMapper.findzb(vid);
    }

    public List<Vip> findtj(String vipid) {
        return lqVipMapper.findtj(vipid);
    }

    public PageVO<Vip> findgy(Integer page, Integer num, String vipname) {
        PageHelper.startPage(page,num);
        Vip lqVip = new Vip();
        lqVip.setVipname(vipname);
        List<Vip> findgy = lqVipMapper.findgy(lqVip);
        PageInfo<Vip> pageInfo = new PageInfo<Vip>(findgy);
        long total = pageInfo.getTotal();
        PageVO<Vip> PageVO = new PageVO<Vip>();
        PageVO.setTotal(total);
        PageVO.setRows(findgy);
        return PageVO;

    }

    public List<Vip> cxsf(String vipname) {
        return lqVipMapper.cxsf(vipname);
    }


}
